#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main() {
    int i = 0;
    int j = 0;
    int n = 0;
    int k = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        int space = (3 * n) - 1 - (3 * i);
        for (j = 0; j < space; j++)
        {
            printf(" ");
        }
        for (k = 0; k <= i; k++)
        {
            printf("*     ");
        }
        printf("\n");
        for (j = 0; j < space - 1; j++)
        {
            printf(" ");
        }
        for (k = 0; k <= i; k++)
        {
            printf("* *   ");
        }
        printf("\n");
        for (j = 0; j < space - 2; j++)
        {
            printf(" ");
        }
        for (k = 0; k <= i; k++)
        {
            printf("* * * ");
        }
        printf("\n");
    }
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < 3 * n - 1; j++)
        {
            printf(" ");
        }
        printf("*\n");
    }
    return 0;
}
#include <stdio.h>
#include<math.h>
int main()
{
    int a = 0;
    int i = 0;
    int j = 0;
    int k = 0;
    int row = 3;
    int col = 5;
    char ch[400][800] = { "  *  "," * * ","* * *" };
    scanf("%d", &a);
    for (i = 0; i < a - 1; i++)
    {
        for (j = 0; j < row; j++)
        {
            for (k = 0; k < col; k++)
            {
                ch[j + row][k] = ch[j][k];
                ch[j + row][k + 1 + col] = ch[j][k];
            }
        }
        for (j = 0; j < row; j++)
        {
            for (k = 0; k < col; k++)
            {
                ch[j][k] = ' ';
            }
        }
        for (j = 0; j < row; j++)
        {
            for (k = 0; k < col; k++)
            {
                ch[j][k + row] = ch[j + row][k];
            }
        }
        row *= 2;
        col = 2 * col + 1;

    }
    for (i = 0; i < row; i++)
    {
        for (j = 0; j < col; j++)
        {
            if (ch[i][j] == '*')
            {
                printf("%c", ch[i][j]);
            }
            else
            {
                printf(" ");
            }
        }
        printf("\n");
    }
    for (i = 0; i < a; i++)
    {
        for (j = 0; j < row - 1; j++)
        {
            printf(" ");
        }
        printf("*\n");
    }
    return 0;
}

int main()
{
    int n = 0;
    int x = 0;
    int count = 0;
    scanf("%d %d", &n, &x);

    for (int i = 1; i <= n; i++)
    {
        int m = i;
        while (m)
        {
            if (m % 10 == x)
            {
                count++;
            }
            m /= 10;
        }
    }
    printf("%d\n", count);
    return 0;
}

int main()
{
    int arr[10] = { 0 };
    int i = 0;
    for (i = 0; i < 10; i++)
    {
        scanf("%d", &arr[i]);
    }
    for (i = 0; i < 10; i++)
    {
        printf("%d ", arr[9 - i]);
    }
    return 0;
}

int main()
{
    int n = 0;
    int arr[100];
    int i = 0;
    int sum = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%d ", &arr[i]);
    }
    for (i = 0; i < n; i++)
    {
        sum = sum + arr[i];
    }
    printf("%d\n", sum);
    return 0;
}


int main()
{
    int n = 0;
    int i = 0;
    int arr[100];
    scanf("%d", &n);
    int max = 0;
    int min = 100;

    for (i = 0; i < n; i++)
    {
        scanf("%d ", &arr[i]);
    }
    for (i = 0; i < n; i++)
    {
        if (arr[i] > max)
        {
            max = arr[i];
        }
        if (arr[i] < min)
        {
            min = arr[i];
        }
    }
    printf("%d\n", max - min);
    return 0;
}
int main()
{
    int i = 0;
    int arr[50] = { 0 };
    int n = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%d ", &arr[i]);
    }
    for (i = 0; i < n; i++)
    {
        for (int j = 0; j < n - i; j++)
        {
            if (arr[j] < arr[j + 1])
            {
                int tmp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = tmp;
            }
        }
    }
    for (i = 0; i < 5; i++)
    {
        printf("%d ", arr[i]);
    }
    return 0;
}